<template>
    <Modal
            v-model="show"
            title="修改"
            @on-ok="save"
            @on-cancel="close"
    >
        <i-form ref="formFilter" label-position="right" :label-width="100">
                    <form-item label="标题：">
                <i-input v-model="dto.title" placeholder="标题"/>
            </form-item>
            <form-item label="创建用户id：">
                <i-input v-model="dto.userId" placeholder="创建用户id"/>
            </form-item>
            <form-item label="创建人昵称：">
                <i-input v-model="dto.userNickName" placeholder="创建人昵称"/>
            </form-item>
            <form-item label="手机号：">
                <i-input v-model="dto.mobile" placeholder="手机号"/>
            </form-item>
            <form-item label="邮箱：">
                <i-input v-model="dto.email" placeholder="邮箱"/>
            </form-item>
            <form-item label="详细内容：">
                <i-input v-model="dto.detail" placeholder="详细内容"/>
            </form-item>
            <form-item label="地址：">
                <i-input v-model="dto.address" placeholder="地址"/>
            </form-item>
            <form-item label="来源：">
                <i-input v-model="dto.source" placeholder="来源"/>
            </form-item>
        </i-form>
    </Modal>
</template>

<script>
    module.exports = {
        props:[],
        data() {
            return {
                show:false,
                dto:{
                    id:undefined,
                    title:undefined,
                    userId:undefined,
                    userNickName:undefined,
                    mobile:undefined,
                    email:undefined,
                    detail:undefined,
                    address:undefined,
                    source:undefined,
                }
            }
        },
        mounted() {

        },
        methods:{
            save() {
                let _this = this;
                _this.loading=true;
                ipost('/admin/news',
                    _this.dto,
                    successRes => {
                        this.$Notice.success({
                            title: '修改成功'
                        });
                        _this.show=false;
                        _this.dto=cleanParams(_this.dto);
                        this.$emit("edit",successRes.data);
                    },failureRes => {
                        console.info("异常",failureRes)
                    }
                )
            },
            edit(data){
                console.info("修改",data)
                this.dto=data;
                this.show=true;
            },
        }
    }
</script>
